package com.ttdev.mmms.repository;

import com.ttdev.mmms.entity.Activity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 活动接口
 */
@Repository
public interface ActivityRepository {

    // 查询活动
    @Select("select * from activity")
    public List<Activity> findAll();

    @Select("select * from activity")
    public List<Activity> findAll1();

    // 查询活动
    @Select("select * from activity where id=#{id}")
    public List<Activity> queryMember(Integer cardId);

    //添加会员
    @Insert("insert into activity(id,content,start,stop,store_id) value(#{id},#{content},#{start},#{stop},#{storeId})")
    public int add(Activity activity);

    //修改会员
    @Update("update activity set content=#{content},start = #{start},stop = # {stop} store_id =#{storeId} where id=#{id}")
    public int update(Activity activity);

    //根据卡号删除会员
    @Delete("delete from activity where id=#{id}")
    public int delete(Integer activity);
}
